package com.bonc.rms.jpa.tms;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.bonc.rms.entity.tms.TalentEntity;

public interface ZTalentRepository extends JpaRepository<TalentEntity, Integer>{
	

	@Query("select count(*) from TalentEntity t "
			+ "where TIMESTAMPDIFF(DAY,t.entryDate,?1) >= ?2 "
			+ "and TIMESTAMPDIFF(DAY,t.entryDate,?1) < ?3 "
			+ "and t.leaveDate = null")
	public int findByWorkExperience(String date, int min ,int max);
	
	@Query("select count(*) from TalentEntity t where substring(identityCardNumber,9,1) = ?1")
	public int findByAge(String age);
	
	@Query("select count(*) from TalentEntity t where t.gender = ?1")
	public int findByGender(String gender);
	
	@Query("select count(*) from TalentEntity t where t.degree = ?1")
	public int findByDegree(String degree);

	@Query("select count(*) from TalentEntity t where t.degree <> '本科' and t.degree <> '硕士' and t.degree <> '博士'")
	public int findOtherDegree();
}
